package com.dragon.repository.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.repository.entity.Team;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author sy
 * @since 2023-06-28
 */
@Mapper
public interface TeamMapper extends BaseMapper<Team> {

    @Select("SELECT M.* FROM(SELECT a.id,a.effective_time,b.username AS userName ,a.department_id,d.`name` AS departName " +
            "FROM `dragon_team` a LEFT JOIN dragon_admin b ON a.admin_id = b.id " +
            "LEFT JOIN dragon_admin_department c ON b.id = c.admin_id " +
            "LEFT JOIN dragon_department d ON c.department_id = d.id WHERE a.project_id = #{id} )M ")
    Page<Team> selectTeam(Page<Team> teamPage,Integer id);
}
